package com.myhexin.consumer.controller;

import com.myhexin.model.UserBean;
import com.myhexin.producer.service.UserService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

/**
 * @author Jayce
 * @version 1.0.0
 * @date 2021/10/7
 * @desc 服务消费者
 */
@RestController
public class UserConsumerController {
    // 引入API
    @DubboReference(check = false, loadbalance = "userLoadBalance")
    private UserService userService;

    @GetMapping("/hello")
    public String sayHelo(@RequestParam(value = "msg") String msg) {
        return userService.sayHelo(msg);
    }

    @ResponseBody
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public String login(UserBean userBean) {
        return userService.login(userBean);
    }
}
